﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows;

namespace WpfDecorator
{
    public class ReflectDecorator : Decorator
    {
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            VisualBrush brush = new VisualBrush();
            brush.Visual = Child;
            brush.RelativeTransform = new ScaleTransform() { ScaleX = 1, ScaleY = -1, CenterX = .5, CenterY = .5 };

            //<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            //                    <GradientStop Color="#00000000" Offset="0.124"/>
            //                    <GradientStop Color="#99FFFFFF" Offset="1"/>
            //                </LinearGradientBrush>
        
               
           
           LinearGradientBrush linerBrush = new LinearGradientBrush() { StartPoint = new Point(.5, 0), EndPoint = new Point(0.5, 1) };
            linerBrush.GradientStops.Add(new GradientStop() { Color = Colors.Black, Offset = 0.124 });
            linerBrush.GradientStops.Add(new GradientStop() { Color = Color.FromArgb(90, 255, 255, 255), Offset = 1 });

            drawingContext.DrawRectangle(brush, new Pen(), new Rect(0, Child.DesiredSize.Height, Child.DesiredSize.Width, Child.DesiredSize.Height));
            drawingContext.DrawRectangle(linerBrush, new Pen(), new Rect(0, Child.DesiredSize.Height, Child.DesiredSize.Width, Child.DesiredSize.Height));
             
        }

    }
}
